<template>
  <div>
    <el-card class="!border-none relative el-card-client" shadow="never">
      <template #header>
        <el-row :gutter="10">
          <el-col :span="3">
            <el-input
              class="input_style_300"
              v-model="queryParams.account"
              clearable
              placeholder="请输入用户名昵称"
            />
          </el-col>
          <el-col :span="15">
            <el-button @click="getLists" color="#63ccba" type="primary" class="btn_style mr_10">
              <template #icon>
                <icon name="el-icon-Search" />
              </template>
              搜索
            </el-button>
          </el-col>
          <el-col :span="6" class="flex justify-end">
            <div>
              <el-button circle plain>
                <template #icon>
                  <el-icon>
                    <Top />
                  </el-icon>
                </template>
              </el-button>
              <el-button circle plain>
                <template #icon>
                  <el-icon>
                    <Bottom />
                  </el-icon>
                </template>
              </el-button>
            </div>
          </el-col>
        </el-row>
      </template>
      <div>
        <el-table
          :data="pager.lists"
          border
          v-loading="pager.loading"
          stripe
          max-height="calc(100vh - 14rem)"
        >
          <el-table-column label="描述" prop="action" show-overflow-tooltip align="center" />
          <el-table-column label="用户名" prop="user_name" show-overflow-tooltip align="center" />
          <el-table-column label="IP" prop="ip" show-overflow-tooltip align="center" />
          <el-table-column label="IP区域" prop="ip_address" show-overflow-tooltip align="center" />
          <el-table-column label="记录时间" prop="create_time" show-overflow-tooltip align="center" />
        </el-table>
      </div>
      <div class="flex position">
        <pagination v-model="pager" class="position" @change="getLists" />
      </div>
    </el-card>
  </div>
</template>

<script lang="ts" setup name="memberLists">
import { usePaging } from "@/hooks/usePaging";
import { useDictData } from "@/hooks/useDictOptions";
import { apiMemberDaily } from "@/api/member";
import { timeFormat } from "@/utils/util";
import feedback from "@/utils/feedback";
import { useRoute } from "vue-router";
const route = useRoute();

// 查询条件
const queryParams = reactive({
  user_id: route.query.id,
  account: "",
});

// 获取字典数据
const { dictData } = useDictData("level,status,type,source");

// 分页相关
const { pager, getLists, resetParams, resetPage } = usePaging({
  fetchFun: apiMemberDaily,
  params: queryParams,
});
getLists();
</script>
<style scoped lang="scss">
.btn_style {
  color: #fff;
}

.mr_10 {
  margin-right: 10px;
}

.pd_l_r {
  padding: 0 10px;
}

.flex {
  display: flex !important;
}
</style>
